package org.osoftware.mumi.dao.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * The Class Region.
 */
@Entity
@Table(name="region")
public class Region extends BaseObject{

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 4572690550961368743L;
	
	/** The name. */
	@Column(name="name")
	private String name;
	
	/** The cities. */
	@OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "region_id", updatable = false, insertable = false, nullable=false)
	private List<City> cities;
	
	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * Gets the cities.
	 *
	 * @return the cities
	 */
	public List<City> getCities() {
		return cities;
	}
	
	/**
	 * Sets the cities.
	 *
	 * @param cities the new cities
	 */
	public void setCities(List<City> cities) {
		this.cities = cities;
	}

	@Override
	public String toString() {
		return "Region [name=" + name + ", cities=" + cities + ", toString()="
				+ super.toString() + "]";
	}
	
	
}
